//
//  DiscoveryHeadView.m
//  Car
//
//  Created by 何晓文 on 15/9/23.
//  Copyright © 2015年 朱鸿儒. All rights reserved.
//

#import "DiscoveryHeadView.h"

@implementation DiscoveryHeadView
- (instancetype)initWithFrame:(CGRect)frame {
	if (self = [super initWithFrame:frame]) {
		//背景
		self.raidoBack = [[UIImageView alloc] initWithFrame:CGRectMake(0, 10, self.width - 10, self.height - 10)];
		
		self.raidoBack.image = [UIImage imageNamed:@"radio"];
		self.raidoBack.clipsToBounds = YES;
		self.raidoBack.backgroundColor = [UIColor clearColor];
		self.raidoBack.userInteractionEnabled = YES;
		[self addSubview:self.raidoBack];
		
		//唱片
		self.rotationView = [[UIImageView alloc] initWithFrame:CGRectMake(25, (self.height - 80) / 2, 80, 80)];
		self.rotationView.image =[UIImage imageNamed:@"album.jpg"];
		[self setUpimageView:self.rotationView];
		[self.raidoBack addSubview: self.rotationView];
		//播放按钮
		self.playButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
		self.playButton.frame = CGRectMake(self.width - 80 - 30, self.height - 80 - 30, 80 , 80 + 5);
		[self.playButton setBackgroundImage:[UIImage imageNamed:@"53a94002d646"] forState:(UIControlStateNormal)];
		[self.raidoBack addSubview:self.playButton];
		//正在播出的节目
		self.titleLablel = [[UILabel alloc] initWithFrame:CGRectMake(self.rotationView.x + self.rotationView.width + 10, self.rotationView.height / 2, 120, 30)];
		self.titleLablel.text = @"汽车电台";
		self.titleLablel.font = [UIFont systemFontOfSize:13];
		self.titleLablel.textColor = [UIColor grapeColor];
		self.titleLablel.textAlignment = NSTextAlignmentLeft;
		[self.raidoBack addSubview:self.titleLablel];
		
				
	}
	return self;
}
- (void)setUpimageView:(UIImageView *)imageView {
	imageView.userInteractionEnabled = YES;
	//允许设置
	imageView.layer.masksToBounds = YES;
	imageView.layer.borderWidth = 2;
	imageView.layer.cornerRadius = imageView.bounds.size.height / 2;
	imageView.layer.borderColor = [[UIColor seashellColor] CGColor];
}
@end
